<script>
  jQuery(document).ready(function(){
    create_header('#team_stats', '500px');
  });
</script>
<form action="index.php" method="post" name="adminForm">
  <div id="tabs" style="padding-top:10px;">
    <ul>
    <? foreach($this->divisions as $division){ ?>
      <li><a href="<?= JURI::base(true) ?>/component/pbny/teams#conference-<?= $division->id?>"><?= $division->name ?></a></li>
    <? } ?>
    </ul>
  </div>  
  <? $cols = array();
     $cols['PPG']  = 'avg_points';
     $cols['FTPG'] = 'avg_free_throws';
     $cols['FPG']  = 'avg_field_goals';
     $cols['3PPG'] = 'avg_three_points';
     $cols['ORPG'] = 'avg_off_rebounds';
     $cols['DRPG'] = 'avg_def_rebounds';
     $cols['APG']  = 'avg_assists';
     $cols['SPG']  = 'avg_steals';
     $cols['BPG']  = 'avg_blocks';
     
     $logo = null;
     if(isset($this->hometeam->logo))
      $logo = $this->hometeam->logo;
  ?>

  <table style="width:100%; text-align:center; margin-top:1em;">  
    <tr>
      <td style="width:200px;" valign="top">
        <div style="margin:5px 10px 10px;padding:0px 10px 5px;">
          <h2 style="margin:0px;padding:0px; width:100%;"><?= $this->hometeam->name ?></h2>
        </div>  
        <img src="<?= PBNYHelper::getFlickrImageUrl($logo->flickr_id, 'small') ?>" width="200px" height="240px" alt="no image"><!-- home team pic -->  
      </td>
      <td>
        <div id="team_stats">
          <h3 style="padding-top:10px;">Teams Stats</h3>
          <table style="width:100%;">
            <tr>
              <td style="width:50%;">
                <? if(isset($this->home)): ?>

                  <table style="width:100%;" class="table">
                    <thead>
                      <tr>
                        <td class="cell_key">HME</td>
                        <td class="cell_key">OPP</td>
                        <td class="cell_key">DIFF</td>
                        <td></td>
                      </tr>
                    </thead>
                    <tbody>
                      
                      <? foreach($cols as $key=>$value){ ?>
                        <tr>
                          <td class="cell_value"><?= $this->home['HME'][$value] ?></td>
                          <td class="cell_value"><?= $this->home['OPP'][$value] ?></td>
                          <td class="cell_value"><?= $this->home['DIFF'][$value] ?></td>
                          <td class="cell_key"><?= $key ?></td>
                        </tr>
                      <? } ?>
                      
                    </tbody>
                  </table>
                    
                <?  endif;
                  
                  $logo = null;
                  if(isset($this->awayteam->logo))
                    $logo = $this->awayteam->logo;
                ?>  
              </td>
              <td>  
                <? if(isset($this->away)): ?>
                  <table style="width:100%;" class="table">
                    <thead>
                      <tr>
                        <td></td>
                        <td class="cell_key">HME</td>
                        <td class="cell_key">OPP</td>
                        <td class="cell_key">DIFF</td>
                      </tr>
                    </thead>
                    <tbody>
                      
                      <? foreach($cols as $key=>$value){ ?>
                        <tr>
                          <td class="cell_key"><?= $key ?></td>
                          <td class="cell_value"><?= $this->away['HME'][$value] ?></td>
                          <td class="cell_value"><?= $this->away['OPP'][$value] ?></td>
                          <td class="cell_value"><?= $this->away['DIFF'][$value] ?></td>
                        </tr>
                      <? } ?>
                      
                    </tbody>
                  </table>
                  
                <?  endif; ?>    
              </td>            
            </tr>
          </table>
        </div>
      </td>
      <td style="width:200px;" valign="top">
        <div style="margin:5px 10px 10px;padding:0px 10px 5px;">
          <h2 style="margin:0px;padding:0px; width:100%;"><?= $this->awayteam->name ?></h2>
        </div>  
        <img src="<?= PBNYHelper::getFlickrImageUrl($logo->flickr_id, 'small') ?>" width="200px" height="240px" alt="no image"><!-- away team pic -->  
      </td>
    </tr>
  </table>
</form>
